﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ETA.IRepository;
using ETA.IService;

namespace ETA.Service
{
    public class RegistrationFamilayService : IRegistrationFamilayService
    {

        #region 属性

        private IRegistrationFamilayRepository _IRegistrationFamilayRepository { set; get; }


        #endregion

        #region 构造函数

        public RegistrationFamilayService(IRegistrationFamilayRepository IRegistrationFamilayRepository)
        {
            _IRegistrationFamilayRepository = IRegistrationFamilayRepository;
        }

        #endregion


        #region IRegistrationFamilayService 成员

        public CreateRegistrationFamilayResponse CreateRegistrationFamilay(CreateRegistrationFamilayRequest req)
        {
            var res = new CreateRegistrationFamilayResponse();
            try
            {
                if (req != null)
                {
                    _IRegistrationFamilayRepository.Insert(req.RegistrationFamilay);
                    res.Result.IsSuccess = true;
                }
            }
            catch (Exception e)
            {
                res.Result.IsSuccess = false;
                res.Result.ErrMessage = e.Message;
            }
            return res;
        }

        public ModifyRegistrationFamilayResponse ModifyRegistrationFamilay(ModifyRegistrationFamilayRequest req)
        {
            var res = new ModifyRegistrationFamilayResponse();
            try
            {
                if (req != null)
                {
                    _IRegistrationFamilayRepository.Update(req.RegistrationFamilay);
                    res.Result.IsSuccess = true;
                }
            }
            catch (Exception e)
            {
                res.Result.IsSuccess = false;
                res.Result.ErrMessage = e.Message;
            }
            return res;
        }

        #endregion
    }
}
